<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习</title>
    <style>
        table {
            border-collapse: collapse;
        }
        
        td {
            padding: 4px 18px;
        }
    </style>
</head>

<body>
    <div id="app">
        <table border="1">
            <tr>
                <th>公司</th>
                <th>岗位</th>
                <th>电话</th>
                <th>坐标</th>
                <th>操作</th>
            </tr>

            <tbody>
                <tr v-for='(item,index) in list' :index='index'>
                    <td>{{item.companyname}}</td>
                    <td>{{item.job}}</td>
                    <td>{{item.phone}}</td>
                    <td>{{item.latlang}}</td>
                    <td>
                        <button @click='deleteView(item.id)'>删除</button>
                        <button @click='getinformation(item.id)'>查看</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <script src="./vue.js"></script>
    <script src="./axios.min.js"></script>

    <script>
        let app = new Vue({
            el: "#app",
            data: {
                list: [], //获取全部列表
            },
            mounted() {
                this.getViewAll() //调用所有列表方法
            },
            methods: {
                // 获取全部列表
                getViewAll() {
                    axios.get('http://39.106.207.209:8100/interview/getInterviewAll').then(res => {
                        // console.log(res.data.data);
                        this.list = res.data.data
                    })
                },
                // 删除一个面试
                deleteView(id) {
                    if (confirm('确定删除吗？？')) {
                        axios.delete('http://39.106.207.209:8100/interview/deleteInterviewById/' + id).then(res => {
                            // console.log(res);
                            this.grtViewAll()
                        })
                    }
                },
            }
        })
    </script>
</body>

</html>